package com.jinyuanchun.learnjava.controller;

import com.jinyuanchun.learnjava.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.xml.ws.Response;
import java.util.Map;

@RestController
public class LoginController {
    @Autowired
    private LoginService loginService;

    @PostMapping("/login")
    public Object login(@RequestParam("usr") String usr, @RequestParam("pwd") String pwd) {
        Map<String,String> data = loginService.login(usr,pwd);
        return data;
    }

    @GetMapping("/hello")
    public Object main(@RequestParam("usr") String usr){
        return "main hello";
    }
}
